package a03demo3;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

public class Test1 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        Collections.addAll(list, "a", "b", "c", "d", "e", "f");

            String dm = dm(list);
            System.out.println(dm);
        System.out.println(list);
    }

    public static String dm(ArrayList<String> list) {
        Collections.shuffle(list);
        Random r = new Random();
        int index = r.nextInt(list.size());

        String name = list.remove(index);
        return name;
    }
}
